from common.message import get_whole_factor_topic, iter_topic, send_topic
import multiprocessing
import time


# from common.variables import TimeFrameType,


def consumer(topic):
    with iter_topic(topic) as it:
        for msg in it:
            print(msg)


def message_look():

    ps = multiprocessing.Process(target=consumer, args=("test_topic",))
    ps.daemon = True
    ps.start()
    time.sleep(1)
    with send_topic("test_topic") as s:
        s.send("hello tester")


if __name__ == "__main__":
    consumer(get_whole_factor_topic())
